#!/user/bin/env python3
# -*- coding: utf-8 -*-
"""
--------------------------------------
    Author:     JiChao_Song
    Data  :     2020/5/8 下午5:22
--------------------------------------
"""

from jinja2 import Environment, FileSystemLoader
import json


def genrtate_html(data):
    # 加载模板
    env = Environment(loader=FileSystemLoader("./"))

    template = env.get_template('demo.html')

    with open('result.html', 'w+') as fout:
        html_content = template.render(data=data)
        fout.write(html_content)


if __name__ == '__main__':
    data = []
    result = {'cabID':1, 'shijian':2019, 'final_result':"正常", 'info':"无",
              'image_path':"test.jpg"}

    for i in range(5):
        data.append(result)

    genrtate_html(data)
